#include "AsioThreadPool.h"
boost::asio::io_context& AsioThreadPool::GetIOService()
{
	return _ioc;
}
void AsioThreadPool::Stop()
{
	_work_guard.reset();
	_ioc.stop();
	for (auto& thread : _threads) {
		thread.join();
	}
}
AsioThreadPool::AsioThreadPool(int size):_ioc(),
_work_guard(boost::asio::make_work_guard(_ioc)){
	for (int i = 0; i < size; ++i) {
		_threads.emplace_back([this]() {
			_ioc.run();
			});
	}
}